home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 118 / cd-rom 118.iso / aplic / open / openofficeorg1.cab / helloworld.bsh < prev    next >
Encoding:
Text File  |  2004-10-22  |  626 b   |  18 lines

  1. // Hello World in BeanShell
  2. import com.sun.star.uno.UnoRuntime;
  3. import com.sun.star.text.XTextDocument;
  4. import com.sun.star.text.XText;
  5. import com.sun.star.text.XTextRange;
  6.  
  7. // get the document from the scripting context which is made available to all 
  8. // scripts
  9. oDoc = XSCRIPTCONTEXT.getDocument();
  10. //get the XTextDocument interface
  11. xTextDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,oDoc);
  12. //get the XText interface
  13. xText = xTextDoc.getText();
  14. // get an (empty) XTextRange at the end of the document
  15. xTextRange = xText.getEnd();
  16. // set the string
  17. xTextRange.setString( "Hello World (in BeanShell)" );
  18.